package com.patterns.abstractFortory.commonAbstractFactory;

import com.patterns.abstractFortory.commonAbstractFactory.abstracts.AbstractCreator;
import com.patterns.abstractFortory.commonAbstractFactory.abstracts.Creator1;
import com.patterns.abstractFortory.commonAbstractFactory.abstracts.Creator2;
import com.patterns.abstractFortory.commonAbstractFactory.productA.AbstractProductA;
import com.patterns.abstractFortory.commonAbstractFactory.productB.AbstractProductB;

/**
 * Created by Xiao Yiyun on 2017/4/19.
 */
public class Client {
    public static void main(String[] args) {
        //定义两个工厂
        AbstractCreator creator1 = new Creator1();
        AbstractCreator creator2 = new Creator2();
        //产生A1对象
        AbstractProductA a1 = creator1.createProductA();
        //产生A2对象
        AbstractProductA a2 = creator2.createProductA();
        //产生B1对象
        AbstractProductB b1 = creator1.createProductB();
        //产生B2对象
        AbstractProductB b2 = creator2.createProductB();

        //执行业务方法
        a1.doSth();
        a2.doSth();
        b1.doSth();
        b2.doSth();
    }
}